package com.llb666.e.shop.api.dto;

import com.llb666.e.shop.domain.entity.bo.SubmitOrderBo;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

/**
 * 用于创建订单的dto对象.
 *
 * @author llb666
 * @date 2022/9/15 17:41
 */
@Data
public class SubmitOrderDto {
    /**
     * 用户Id
     */
    private String userId;
    /**
     * 商品规格Id
     */
    private String itemSpecIds;
    /**
     * 地址Id
     */
    private String addressId;
    /**
     * 支付方式
     */
    private Integer payMethod;
    /**
     * 买家留言
     */
    private String leftMsg;

    /**
     * 订单创建时用到的token
     */
    private String token;

    @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
    public interface Converter {
        SubmitOrderDto.Converter INSTANCE = Mappers.getMapper(SubmitOrderDto.Converter.class);
        SubmitOrderBo dto2bo(SubmitOrderDto activity);
    }
}
